Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement conversion of masm ir to 'real' masm #35

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

bitwalker
Copy link
Contributor

As the PR title states, this enables conversion from our internal MASM IR to the "real" MASM representation provided by the miden-assembly crate. We can then emit to disk using those APIs, compile via the assembler, or run with the Miden VM.

NOTE: This PR omits a couple things pending some other work:

  1. Emission of MASL libraries is blocked by feat(assembly): allow creation of masl libraries via api miden-vm#1108
  2. The initialization of root context memory (i.e. writing data segments to the heap) is not yet implemented. We'll probably implement something here in the near future, but I'm punting a bit while I work on some other things
  3. The function table that we'll want to write to memory to support dynexec is on hold until Implement support for indirect calls via dynexec/procref #32 is implemented

@bitwalker bitwalker self-assigned this Oct 17, 2023
Copy link
Contributor

@greenhat greenhat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! Only a few minor notes.

let invoked = BTreeMap::from([(entry_id, (entry_name, entry_module_path))]);
let imports = ModuleImports::new(imported, invoked);

// TODO: Write data segments, initialize function table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would an issue be a better fit for these tasks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do have one for this, basically #32 describes the function table. The data segments I'm planning to revisit later this week or early next, so this is just a reminder that this location needs to handle those items when implemented. I my Emacs config makes use of comments like these to produce a navigable list of TODOs in the code that I use as a functional TODO list, so if you see comments like this, they don't just go into the ether :). That said, it's a good to remind me to create issues for these things, since sometimes I don't have immediate plans to address them.

hir/src/asm/isa.rs Outdated Show resolved Hide resolved
@bitwalker bitwalker merged commit cae1674 into main Oct 18, 2023
2 checks passed
@bitwalker bitwalker deleted the bitwalker/emit-masm branch October 18, 2023 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants